

from config import HOST


class ApiApproveTrust:
    def __init__(self,session):
        # session
        self.session=session
        # url
        self.__url_approve=HOST+"/member/realname/approverealname"
        self.__url_approve_info=HOST+"/member/member/getapprove"
        self.__url_trust=HOST+"/trust/trust/register"
        self.__url_img_code=HOST+"/common/public/verifycode/{}"
        self.__url_recharge=HOST+"/trust/trust/recharge"
    #     认证
    def api_approve(self):
        # 定义请求参数
        data={
            "realname":"张三","card_id":"140105197903071871"
        }
        # 返回被调用接口
        return self.session.post(url=self.__url_approve,data=data,files={"x":"y"})
    # 认证消息
    def api_approve_info(self):
        return self.session.post(url=self.__url_approve_info)
    # 后台开户
    def api_trust(self):
        return self.session.post(url=self.__url_trust)
    # 图片验证码
    def api_img_code(self,r):
        return self.session.get(url=self.__url_img_code.format(r))
    # 后台充值
    def api_recharge(self,valicode):
        # 请求参数
        data={
            "paymentType":"chinapnrTrust","amount":10000,"formStr":"reForm","valicode":valicode
    }
    # 返回接口
        return self.session.post(url=self.__url_recharge,data=data)